﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Drawing2D;
using System.Drawing;
using System.Windows.Forms;

namespace 桌面视频录制
{
    [Serializable]
    public class DrawCurveWithCap : DrawCurve
    {
        public DrawCurveWithCap(Point startPoint)
            : base(startPoint) { }
        public override void Draw(System.Drawing.Graphics g)
        {
            if (pointList.Count > 2)
            {
                Pen pen = new Pen(this.PenColor);
                AdjustableArrowCap arrow = new AdjustableArrowCap(4, 4, true);
                pen.CustomEndCap = arrow;
                pen.Width = this.PenWidth;
                g.DrawCurve(pen, pointList.ToArray());
                arrow.Dispose();
                pen.Dispose();
            }
        }
        public override string ToString()
        {
            string printMsg = "[曲箭(" + this.pointList[0].X + "," + this.pointList[0].Y + ")]->[ID:" + this.Id + "]";
            return printMsg;
        }
        public override string GetDrawObjectMsg()
        {
            string drawObjectMsg = "曲箭->起始位置(" + this.pointList[0].X + "," + this.pointList[0].Y + "),终点位置(" + this.pointList[pointList.Count - 1].X + "," + this.pointList[pointList.Count - 1].Y + "),样本点数:" + pointList.Count + "个";
            return drawObjectMsg;
        }
    }
}
